<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/question.css" rel="stylesheet" type="text/css"/>
</block>

<block name="body">
    <div class="col-md-12">
        <include file="Public/user_info"/>
        <include file="Public/_top_menu"/>
    </div>

    <div class="col-md-12 ask_question">
        <div class="bgwhite" style="min-height: 1000px;padding-bottom: 50px;margin-top: 0">
            <div class="question_h" style="">
                <h2 class="pull-left" style="width: 120px;">发布问题</h2>
            </div>


            <form class="form-horizontal ajax-form" role="form" action="{:U('question/usercenter/ask')}" method="post"
                  id="edit-article-form">
                <input type="hidden" name="question_id" value="{$question.id}"/>

                <div class="row has-feedback">
                    <!-- 帖子分类 -->
                    <div class="col-sm-12" style="padding: 30px">
                        <div class="form-group">
                            <label for="inputTitle" class="col-sm-1 control-label">标题<span
                                    class="text_must">*</span></label>

                            <div class="col-sm-5">
                                <input type="text" name="title" class="form-control form_check" check-type="Text"
                                       check-length="4,20" id="inputTitle" value="{$question.title}">
                            </div>
                            <span class="col-sm-5 tip" style="">一句话简述，不超过20字（不能带有任何联系方式）</span>
                        </div>


                        <div class="form-group">
                            <label class="col-sm-1 control-label">类别<span class="text_must">*</span></label>

                            <div class="col-sm-10">
                                <label for="id_type_0" style="font-weight: normal;margin-right: 5px;">
                                    <input id="id_type_0" name="type" value="0" type="radio" <eq name="question['type']" value="0">checked</eq>>
                                    全部
                                </label>
                                <volist name="typeList" id="val">
                                    <label for="id_type_{$val.id}" style="font-weight: normal;margin-right: 5px;">
                                        <input id="id_type_{$val.id}" name="type" value="{$val.id}" type="radio" <eq name="question['type']" value="$val['id']">checked</eq>>
                                        {$val.title}</label>
                                </volist>
                            </div>

                        </div>


                        <div class="form-group">
                            <label class="col-sm-1 control-label">描述<span
                                    class="text_must">*</span></label>

                            <div class="col-sm-10">

                                <php>$config='toolbar:[\'bold forecolor justifyleft justifycenter justifyright | image video link \']';
                                </php>
                                {:W('Question/UeditorMini/editor',array('myeditor_edit','explain',$question['content'],'95%','300px',$config))}

                                <div class="" style="font-size: 13px;">
                                    <p style="color: #a0a0a0">
                                        描述里面最好写一些你需要帮助的具体细节，放一些你自己的照片或视频这样大家会更愿意帮忙，也可以放一些图片或视频的样例供参考。
                                    </p>

                                    <p style="color: #ff0000">
                                        注明：描述中不能带有电话、QQ、微信等联络方式，也不能带有色情或违法的内容，否则将不能通过审核！还会被打屁屁的哟！！
                                    </p>
                                </div>

                            </div>


                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">封面<span class="text_must">*</span></label>
                            <div  class="col-sm-10">
                                <a class="upload_cover btn btn-primary button_change" href="{:U('question/index/_uploadcover_ask')}">上传封面</a>
                                <input type="hidden" name="cover_id" value="{$question.cover_id}">
                                <div class="upload-img-box" style="margin-top: 10px;width: 250px;height: 250px;overflow: hidden;">
                                    <if condition="$question['cover_id']">
                                        <div class="upload-pre-item"><img src="{$question.cover_id|get_cover='path'}"/></div>
                                    </if>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <p class="" style="margin: 0 auto;width: 101px;">
                    <button type="submit" class="btn btn-large btn-primary button_change" id="submit-button">
                            <span id="submit-content">
                                <if condition="$isEdit">
                                    修改
                                    <else/>
                                    完成发布
                                </if>
                            </span>
                    </button>
                    <input type="hidden" id="isEdit" value="{$isEdit}">
                </p>

            </form>


        </div>
    </div>
</block>
<block name="script">
    <script>
        $(function () {
            bindUploadCover();
        });
        function bindUploadCover() {
            $('.upload_cover').magnificPopup({
                type: 'ajax',
                overflowY: 'scroll',
                modal: true,
                callbacks: {
                }
            });
        }
    </script>
    <script type="text/javascript" src="__PUBLIC__/Core/js/form_check.js"></script>
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
</block>

